include("../../static/js/config.js");
include("../../static/js/common.js");

$(function () {
    var form;
    layui.use(['laydate', 'form'], function () {
        form = layui.form;

        form.on('submit(save)', function(data){
            var name = $("#name").val();
            var description = $("#description").val();

            request("/admin/role/save", {name:name, description:description}, function (data) {
                if (data.code == 200){
                    layer.msg("操作成功", {icon: 1});
                    setTimeout(function () {
                        if (window.parent){
                            window.parent.layer.closeAll();
                            window.parent.location.reload();
                        }
                    }, 3000);
                }
            });
            return false;
        });
    })

});
